package com.strategy;

public class Strategy1 {
    private double getResult(String choose, String price, String num){
        double totalPrices;
        switch (choose){
            //不打折
            case "0":
                totalPrices = Double.valueOf(price)*Double.valueOf(num);
                break;
             //八折
            case "1":
                totalPrices = Double.valueOf(price)*Double.valueOf(num)*0.8;
                break;
            //七折
            case "2":
                totalPrices = Double.valueOf(price)*Double.valueOf(num)*0.7;
                break;
            default:
                throw new IllegalStateException("Unexpected value: " + choose);
        }
        return totalPrices;
    }

    private double getResult1(String choose, String price, String num){
        CashContext cashContext;
        cashContext = new CashContext("满300-30");//选择方式
        double totalPrices = 0d;
        totalPrices = cashContext.getResult(Double.valueOf(price)*Double.valueOf(num));
        return totalPrices;
    }
}
